home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / WIN / DOSERR.C next >
C/C++ Source or Header  |  1994-12-17  |  5KB  |  111 lines

  1. #include <errno.h>
  2. #include <sys/doscalls.h>
  3.  
  4. #define N_DOS_ERRORS 0x5A
  5.  
  6. #define RESERVED  EIO
  7.  
  8. static unsigned char dos_errors[N_DOS_ERRORS + 1] =
  9. {
  10.     0,                /* 0x00  no error                                 */
  11.     EINVAL,            /* 0x01  function number invalid                 */
  12.     ENOENT,            /* 0x02  file not found                         */
  13.     ENOENT,            /* 0x03  path not found                         */
  14.     EMFILE,            /* 0x04  too many open files                     */
  15.     EACCES,            /* 0x05  access denied                         */
  16.     EBADF,            /* 0x06  invalid handle                         */
  17.     EIO,            /* 0x07  memory control block destroyed         */
  18.     ENOMEM,            /* 0x08  insufficient memory                     */
  19.     EIO,            /* 0x09  memory block address invalid             */
  20.     EINVAL,            /* 0x0A  environment invalid                     */
  21.     ENOEXEC,            /* 0x0B  format invalid                         */
  22.     EINVAL,            /* 0x0C  access code invalid                     */
  23.     EINVAL,            /* 0x0D  data invalid                             */
  24.     RESERVED,            /* 0x0E  reserved                                 */
  25.     EACCES,            /* 0x0F  invalid drive                         */
  26.     EACCES,            /* 0x10  attempted to remove current directory   */
  27.     EXDEV,            /* 0x11  not same device                         */
  28.     ENOENT,            /* 0x12  no more files                         */
  29.     EIO,            /* 0x13  disk write-protected                     */
  30.     EIO,            /* 0x14  unknown unit                             */
  31.     EIO,            /* 0x15  drive not ready                         */
  32.     EIO,            /* 0x16  unknown command                         */
  33.     EIO,            /* 0x17  data error                              */
  34.     EIO,            /* 0x18  bad request structure length             */
  35.     EIO,            /* 0x19  seek error                              */
  36.     EIO,            /* 0x1A  unknown media type                      */
  37.     EIO,            /* 0x1B  sector not found                         */
  38.     ENOSPC,            /* 0x1C  printer out of paper                     */
  39.     EIO,            /* 0x1D  write fault                             */
  40.     EIO,            /* 0x1E  read fault                              */
  41.     EIO,            /* 0x1F  general failure                         */
  42.     EACCES,            /* 0x20  sharing violation                         */
  43.     EACCES,            /* 0x21  lock violation                         */
  44.     EIO,            /* 0x22  disk change invalid                     */
  45.     EIO,            /* 0x23  FCB unavailable                         */
  46.     EIO,            /* 0x24  sharing buffer overflow                 */
  47.     EIO,            /* 0x25  code page mismatch                      */
  48.     EIO,            /* 0x26  cannot complete file operation         */
  49.     ENOSPC,            /* 0x27  insufficient disk space                 */
  50.     RESERVED,            /* 0x28  reserved                                 */
  51.     RESERVED,            /* 0x29  reserved                                 */
  52.     RESERVED,            /* 0x2A  reserved                                 */
  53.     RESERVED,            /* 0x2B  reserved                                 */
  54.     RESERVED,            /* 0x2C  reserved                                 */
  55.     RESERVED,            /* 0x2D  reserved                                 */
  56.     RESERVED,            /* 0x2E  reserved                                 */
  57.     RESERVED,            /* 0x2F  reserved                                 */
  58.     RESERVED,            /* 0x30  reserved                                 */
  59.     RESERVED,            /* 0x31  reserved                                 */
  60.     EIO,            /* 0x32  network request not supported         */
  61.     EIO,            /* 0x33  remote computer not listening         */
  62.     EIO,            /* 0x34  duplicate name on network                 */
  63.     EIO,            /* 0x35  network name not found                 */
  64.     EIO,            /* 0x36  network busy                             */
  65.     EIO,            /* 0x37  network device no longer exists         */
  66.     EIO,            /* 0x38  network BIOS command limit exceeded     */
  67.     EIO,            /* 0x39  network adapter hardware error         */
  68.     EIO,            /* 0x3A  incorrect response from network         */
  69.     EIO,            /* 0x3B  unexpected network error                 */
  70.     EIO,            /* 0x3C  incompatible remote adapter             */
  71.     ENOSPC,            /* 0x3D  print queue full                         */
  72.     ENOSPC,            /* 0x3E  queue not full                         */
  73.     EIO,            /* 0x3F  not enough space to print file         */
  74.     EIO,            /* 0x40  network name was deleted                 */
  75.     EACCES,            /* 0x41  network: Access denied                 */
  76.     EIO,            /* 0x42  network device type incorrect         */
  77.     EIO,            /* 0x43  network name not found                 */
  78.     EIO,            /* 0x44  network name limit exceeded             */
  79.     EIO,            /* 0x45  network BIOS session limit exceeded     */
  80.     EIO,            /* 0x46  temporarily paused                      */
  81.     EIO,            /* 0x47  network request not accepted             */
  82.     EIO,            /* 0x48  network print/disk redirection paused   */
  83.     EACCES,            /* 0x49  invalid network version                 */
  84.     EIO,            /* 0x4A  account expired                         */
  85.     EIO,            /* 0x4B  password expired                         */
  86.     EIO,            /* 0x4C  login attempt invalid at this time      */
  87.     EIO,            /* 0x4D  disk limit exceeded on network node     */
  88.     EIO,            /* 0x4E  not logged in to network node         */
  89.     RESERVED,            /* 0x4F  reserved                                 */
  90.     EEXIST,            /* 0x50  file exists                             */
  91.     RESERVED,            /* 0x51  reserved                                 */
  92.     ENOENT,            /* 0x52  cannot make directory                 */
  93.     EIO,            /* 0x53  fail on INT 24h                         */
  94.     EIO,            /* 0x54  too many redirections                 */
  95.     EIO,            /* 0x55  duplicate redirection                 */
  96.     EIO,            /* 0x56  invalid password                         */
  97.     EINVAL,            /* 0x57  invalid parameter                         */
  98.     EIO,            /* 0x58  network write fault                     */
  99.     EIO,            /* 0x59  function not supported on network         */
  100.     EIO             /* 0x5A  required system component not installed */
  101. };
  102.  
  103. void _sys_doserror2errno(unsigned short error_dos)
  104. {
  105.     if (error_dos >= N_DOS_ERRORS)
  106.     errno = EIO;
  107.     else
  108.     errno = dos_errors[error_dos];
  109. }
  110.  
  111.